const router = require('koa-router')();
const { userloginController } = require('../controllers/login');

module.exports = (app) => {

    /**router.post()配置post路由 */
    router.post('/api/user/login',  async (ctx, next)=>{
        if(ctx.request.body && ctx.request.body.username ){
            let result = await userloginController(ctx.request.body)
            ctx.body = result;
            
        }else{
            ctx.body = {
                success: false
            }
        }
        
    })
    
    app.use(router.routes()).use(router.allowedMethods());
}